package com.hb.game.pk.adpter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hb.game.pk.APP;
import com.hb.game.pk.R;
import com.hb.game.pk.beans.FriendBean;
import com.hb.game.pk.utils.StringUtils;

public class ContactListAdapter extends BaseQuickAdapter<FriendBean.DataBean, BaseViewHolder> {

    public ContactListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, FriendBean.DataBean item) {
        String trim = StringUtils.getString(item.getFace());
        int res = 0;
        if (StringUtils.isEmpty(trim)) {
            res = R.mipmap.ic_head_normal;
        } else {
            int i = Integer.parseInt(trim);
            res = APP.headResource.get(i - 1);
        }
        helper.setImageResource(R.id.iv_head, res);
        helper.setText(R.id.tv_name, item.getNickname());
    }
}
